<!DOCTYPE html>
<html>

<head>
	<!-- 页面meta -->
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>规格管理</title>
	<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
	<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="../adminLTE/css/AdminLTE.css">
	<link rel="stylesheet" href="../adminLTE/css/skins/_all-skins.min.css">
	<link rel="stylesheet" href="../css/style.css">
	<link rel="stylesheet" href="../angularjs/pagination.css">
	<script src="../jQuery/jquery-2.2.3.min.js"></script>
	<script src="../bootstrap/js/bootstrap.min.js"></script>

	<script src="../angularjs/angular.min.js"></script>
	<script src="../angularjs/pagination.js"></script>
	<script>
        var app=angular.module('aisile', []);//定义模块
        app.controller('TestController' ,function($scope,$http){
            //读取列表数据绑定到表单中
            $scope.findAll=function(){
                    $http.get('../ping/list').success(
                        function(response){
                            console.log(response);
                            $scope.list=response;
                        }
                    );
            }
            //查询实体
            $scope.pre=function(tid){
                if(tid==1){

                    alert("已经是第一题");
				}else {
                    tid -=1 ;
                    $http.post('../ping/list?tid='+tid).success(
                        function(response){
                            $scope.list=response;
                        }
                    );
				}
            }
            //查询实体
            $scope.next=function(tid){
                if(tid==5){
                    alert("已经是最后一题");
                }else {
                    tid +=1;
                    $http.post('../ping/list?tid='+tid).success(
                        function(response){
                            $scope.list=response;
                        }
                    );
				}
            }

            $scope.commit=function(){

                $http.post('../record/update').success(
                    function(response){
                        alert(response);
                    }
                );
            }


        });
	</script>
</head>

<body class="hold-transition skin-red sidebar-mini" ng-app="aisile" ng-controller="TestController" ng-init="findAll()">

<div class="box-body" align="center">
	<!-- 数据表格 -->
<thead>
			<tr>
				<td>{{list.topic.tid}}：{{list.topic.tname}}</td>
			</tr>

</thead>

<tbody>
<ul  ng-repeat='o in list.options'>
	<li>
		<input type='radio'>
		{{o.xid}}.
		{{o.xname}}
	</li>
</ul>
</tbody>
	</div>

</body>
<div align="center">
	<div class="form-group form-inline">
		<div class="btn-group">
			<button type="button" class="btn btn-default" title="上一题" ng-click="pre(list.topic.tid)"><i class="fa fa-trash-o"></i> 上一题</button>
			<button type="button" class="btn btn-default" title="下一题" ng-click="next(list.topic.tid)"><i class="fa fa-trash-o"></i> 下一题</button>
			<button type="button" class="btn btn-default" title="提交" ng-click='commit()' ><i class="fa fa-trash-o"></i> 提交</button>
		</div>
	</div>
</div>


</body>

</html>